using FubuMVC.Core;

namespace thunderdome.Controllers.Math
{
    public class CalculatorController
    {
        public CalculatorOutputModel View(CalculatorInputQuery input)
        {
            return new CalculatorOutputModel();
        }

        public AddOutputModel Add(AddInputCommand input)
        {
            var result = input.Left + input.Right;
            return new AddOutputModel
                       {
                           Left = input.Left,
                           Right = input.Right,
                           Result = result
                       };
        }

        [UrlPattern(@"Calculator/Add/{Left}+{Right}")]
        public AddOutputModel Add(AddInputQuery input)
        {
            var result = input.Left + input.Right;
            return new AddOutputModel
                       {
                           Left = input.Left,
                           Right = input.Right,
                           Result = result
                       };
        }
    }

    public class CalculatorOutputModel
    {
        public int Left { get; set; }
        public int Right { get; set; }
    }

    public class CalculatorInputQuery
    {
    }

    public class AddOutputModel
    {
        public int Left { get; set; }
        public int Right { get; set; }
        public int Result { get; set; }
    }

    public class AddInputQuery
    {
        public int Left { get; set; }
        public int Right { get; set; }
    }

    public class AddInputCommand
    {
        public int Left { get; set; }
        public int Right { get; set; }
    }
}